import java.util.*;
//将一句话的单词进行倒置，标点不倒置。比如 I like beijing. 经过函数后变为：beijing. like I
public class Main2 {
    public static void reverse(char[] array,int start,int end) {
        while (start <= end) {
            char tmp = array[start];
            array[start] = array[end];
             array[end] = tmp;
              start++;
              end--;
        }
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
         char[] ch = s.toCharArray();
         int len  = ch.length-1;
        reverse(ch,0,len);
          int i = 0;
         while ( i <= len) {
             int j = i;
             while (j <= len && ch[j] != ' ') {
                 j++;
             }
             if (j <= len) {
                 reverse(ch, i, j-1);
                 i = j + 1;
             } else {
                 reverse(ch, i, j - 1);
                  i = j;
             }
         }
         String str = new String(ch);
        System.out.println(str);
    }
}
